<template>
  <el-dialog title="聊天记录" :visible.sync="$attrs.visableIf" @close="handleCloseDialog" :close-on-click-modal="false" :close-on-press-escape="false" append-to-body width="700px">
    <div class="chatHistory">
      <div class="chart-li">
        <div class="chart-time">2024-04-13 11:37:52</div>
        <div class="chart-item">
          <div class="chart-img"><img src="@/assets/images/chart-img.jpg"/></div>
          <div class="chart-name">总有刁民想害朕</div>
          <div class="chart-content">
             今天是星期三
          </div>
        </div>

      </div>
      <div class="chart-li">
        <div class="chart-time">2024-04-13 11:37:52</div>
        <div class="chart-item">
          <div class="chart-img"><img src="@/assets/images/chart-img.jpg"/></div>
          <div class="chart-name">总有刁民想害朕</div>
            <div class="img"><img src="@/assets/images/brandSettings.png"/></div>
        </div>
      </div>
      <div class="chart-li">
        <div class="chart-time">2024-04-13 11:37:52</div>
        <div class="chart-item">
          <div class="chart-img"><img src="@/assets/images/chart-img.jpg"/></div>
          <div class="chart-name">总有刁民想害朕</div>
          <div class="chart-content">
            <div class="file">
<!--              <img src="@/assets/images/txt.png" class="file-type" />-->
<!--              <img src="@/assets/images/excel.png" class="file-type"/>-->
              <img src="@/assets/images/word.png" class="file-type"/>
              <div class="file-name">小程序跳到h5的按钮<span>.txt</span></div>
              <div class="file-size">23M</div>
            </div>
          </div>
        </div>
      </div>
      <div class="chart-li chart-right">
        <div class="chart-time">2024-04-13 11:37:52</div>
        <div class="chart-item">
          <div class="chart-img"><img src="@/assets/images/chart-img.jpg"/></div>
          <div class="chart-name">总有刁民想害朕</div>
          <div class="img"><img src="@/assets/images/brandSettings.png"/></div>
        </div>
      </div>
      <div class="chart-li chart-right">
        <div class="chart-time">2024-04-13 11:37:52</div>
        <div class="chart-item">
          <div class="chart-img"><img src="@/assets/images/chart-img.jpg"/></div>
          <div class="chart-name">总有刁民想害朕</div>
          <div class="chart-content">
            <div class="file">
              <!--              <img src="@/assets/images/txt.png" class="file-type" />-->
              <!--              <img src="@/assets/images/excel.png" class="file-type"/>-->
              <img src="@/assets/images/word.png" class="file-type"/>
              <div class="file-name">小程序跳到h5的按钮<span>.txt</span></div>
              <div class="file-size">23M</div>
            </div>
          </div>
        </div>
      </div>
      <div class="chart-li chart-right">
        <div class="chart-time">2024-04-13 11:37:52</div>
        <div class="chart-item">
          <div class="chart-img"><img src="@/assets/images/chart-img.jpg"/></div>
          <div class="chart-name">总有刁民想害朕</div>
          <div class="chart-content text">
            今天是星期三
          </div>
        </div>

      </div>
    </div>
    <div class="footer-btn" slot="footer">
      <el-button @click="handleCloseDialog">关闭</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: 'chatHistory',
  components: {},
  data() {
    return {
      form: {
        name: null,
      },
      rules: {
        'name': [
          {required: true, message: '请输入标签名称', trigger: 'blur'}
        ],

      },
    }
  },
  created() {
  },
  mounted() {
  },
  watch: {},
  methods: {
    onSubmit(formName) {
      //提交的代码
      this.$refs[formName].validate((valid) => {
        if (valid) {
          console.log('提交表单');
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    handleCloseDialog() {
      this.$emit('update:visableIf', false);
      this.$emit('handleQuery');
    }
  }
}
</script>

<style scoped lang="scss">
.chatHistory {
  display: flex;
  flex-direction: column;
  .chart-li {
    padding: 10px 16px;
    position: relative;
    box-sizing: border-box;
    .chart-item{
      position: relative;
      padding-left:60px;
      .chart-img {
        width: 40px !important;
        height: 40px !important;
        border-radius: 4px !important;
        overflow: hidden;
        position: absolute;
        left: 0px;
        img {
          width: 100%;
          height: 100%;
          object-fit: cover;
        }
      }
      .chart-name{
        display: inline-block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: calc(100% - 50px);
        width: 80%;
        color: #888999;
        margin-bottom: 5px;
      }
      .chart-content {
        background: #fff;
        padding: 6px 12px;
        font-size: 15px;
        color: #000;
        border: 1px solid #e9e9e9;
        border-radius: 5px;
        display: inline-block;

      }

      .img {
        img {
          max-width: 150px;
          width: auto;
          height: auto;
          max-height: 200px;
        }

      }
    }
    .chart-time {
      padding: 10px 0;
      text-align: center;
      color: #888999;
    }
    &.chart-right{
      display: flex;
      justify-content: flex-end;
      flex-direction: column;
      .chart-item {
        padding-right: 60px;
        display: block;
        text-align: right;
        .chart-img {
          right: 0px;
          left: auto;
        }
        .text {
          background: #98e165;
          border-color: #98e165;
        }
      }
    }
  }
}
.file {
  position: relative;
  padding-left: 60px;
  min-height: 50px;
  background: #fff;
.file-type {
  width: 50px;
  height: 50px;
  position: absolute;
  left: 0px;
  top: 0px;
}
  .file-name {
    font-size: 13px;
  }
  .file-size {
    margin: 5px 0 0;
    font-size: 12px;
    color: #a1a7b7;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }

}
::v-deep .el-dialog__body {
  max-height: 600px;
  overflow-y: auto;
}
</style>
